Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Liberation: Add a data liberation handbook setup #374

Merged
merged 5 commits into from
Jan 22, 2024

Conversation

dd32
Copy link
Member

@dd32 dd32 commented Dec 20, 2023

This PR adds the necessary things to the theme to support the import of the data liberation guides as a handbook.

See WordPress/data-liberation#46 for the manifest it uses.

This requires that the site be running the 'Handbook' and 'Wporg Markdown' plugins.
@dd32 dd32 changed the title Add a data liberation handbook setup Data Liberation: Add a data liberation handbook setup Dec 20, 2023
@dd32
Copy link
Member Author

dd32 commented Dec 20, 2023

I don't think cron tasks work correctly in the local environment, so you'll probably have to run them manually when required:

yarn wp-env run cli wp cron event run --due-now

@dd32
Copy link
Member Author

dd32 commented Dec 20, 2023

Just noting, if we want to commit/deploy this prior to resolving all style issues, and as a result have the /and/{guide} route not work for non-editors, we can disable it from loading with something like this:

add_filter( 'handbook_post_type_defaults', function( $args, $slug ) {
    if (
	    'and' === $slug &&
	    ! current_user_can( 'edit_handbook_pages' ) &&
	    ! wp_doing_cron() &&
	    ! ( defined( 'WP_CLI' ) && WP_CLI )
    ) {
	    return false;
    }
    
    return $args;
}, 10, 2 );

Additionally, we probably also want to add a check in here that only loads it for not-rosetta sites, as we currently have no way to translate handbooks (which is a separate issue, and this is not going to resolve)

edit: in retrospect, just not enabling the handbook plugin on rosetta will result in that, so nevermind!

@StevenDufresne
Copy link
Contributor

StevenDufresne commented Dec 21, 2023

The only question I have is the url structure.

We currently have wp.org/data-liberation as the landing page.

I imagine we could change /data-liberation to /and so then we could have:

  • wp.org/and
  • wp.org/and/{platform}

I don't know that the following reads that well:

  • wp.org/data-liberation
  • wp.org/data-liberation/and
  • wp.org/data-liberation/and/{platform}

However we do need the following:

  • Landing page
  • Archive page
  • Single page

So maybe it makes sense to make /data-liberation the root.

@dd32
Copy link
Member Author

dd32 commented Dec 21, 2023

Yeah I wasn't sure on that either :)

The good news is that we can change the base slug easily.

Currently the PR for the handbook simply sets w.org/and/ as a post type index, but as you've probably seen, creating a specific page in GitHub (welcome, index, handbook, or and-handbook) would place that at w.org/and instead. We probably don't want to use a specific page like that though, we probably just want the post-type archives and our custom landing pages.

Based on the WordPress/data-liberation contents, it might make sense to split it up into a few different "sections" of content, based on the intention of the underlying guide:

  • Move to WordPress (from another platform)
  • Move from non-core to Core Blocks
  • Other Tools

so something like:

  • w.org/data-liberation/from/ (archive)
  • w.org/data-liberation/from/{platform} (single)
  • w.org/data-liberation/migration-guide/ (archive of the subsections:)
  • w.org/data-liberation/migration-guide/{plugin}-to-{blocks} (single)

@StevenDufresne StevenDufresne merged commit 335de50 into trunk Jan 22, 2024
2 checks passed
@StevenDufresne StevenDufresne deleted the add/data-liberation-handbook branch January 22, 2024 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants